﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;

namespace ITAP.ContourBuilder.Components
{
    public static class EnumerableExtension
    {
        public static int GetCount<T>(this IEnumerable<T> enumerable)
        {
            if (enumerable is ICollection<T>)
                return (enumerable as ICollection<T>).Count;

            int count = 0;
            foreach (T item in enumerable)
                count++;

            return count;
        }

    }
}
